/*
 * ContAssignMonitorDescription.java
 * 
 * last update: 30.01.2010 by Vlad Badoiu
 * 
 * author:	Vlad Badoiu(vladbadoiu@gmail.com)
 *
 * Obs:
 */
package engine;

@SuppressWarnings("serial")
class ContAssignMonitorDescription extends MonitorDescription{
	AssignableSelection lValue;
	int lineNo;
	Delay3Description delays;
	byte strength;

	/**
	 * @exception ParseException if the AssignableSelection cannot be converted
	 *                 for continuous assign
	 */
	ContAssignMonitorDescription(NameSpaceDescription nsd, int lineNo,
			AssignableSelection lValue, 
			ExpressionDescription target,
			Delay3Description delays, byte strength)
			throws ParseException
			{
		super(nsd, target);
		this.lValue = lValue;
		this.lineNo = lineNo;
		this.delays = delays;
		try {
			lValue.toContSelection(strength);
		} catch (ParseException pex) {
			throw new ParseException (nsd.toString(lineNo) + ": error: " + pex);
		}
			}

	Monitor instantiate(NameSpace ns)throws ParseException{
		try{
			return new ContAssignMonitor(ns, (LeftValue)lValue.instantiate(ns), 
					target.instantiate(ns),
					delays.instantiate(ns));
		}catch(ParseException ex){
			xConsole.dumpStack(ex);
			throw new ParseException (ns.desc.toString(lineNo) +  ": error:" +  ex);
		}catch(InterpretTimeException ex){
			xConsole.dumpStack(ex);
			throw new ParseException (ns.desc.toString(lineNo) + ": error:" + ex); 
		}
	}

}



